package com.bot.pms.common.config.dateConverter;

import org.springframework.core.convert.converter.Converter;
import org.springframework.util.StringUtils;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class LocalTimeConverter  implements Converter<String, LocalTime> {

    /**
     * Time格式化字符串
     */
    private final String DEFAULT_TIME_FORMAT = "HH:mm:ss";

    @Override
    public LocalTime convert(String source) {
        if (StringUtils.isEmpty(source)) {
            return null;
        }
        return LocalTime.parse("", DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT));
    }
}
